<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo Yii::$app->name;?> 后台管理</title>
<?php $this->HeaderView(['webuploader', 'datetimepicker','ueditor']);?>
</head>
<body class="view_form" id="view_form_Auction">
                    
 <form id="view-form-form" class="view-form-form" method="post" action="<?php echo \Yii::$app->urlManager->createUrl([$model->postid ? 'post/update' : 'post/create', 'postid'=>$model->postid]);?>" enctype="multipart/form-data">
        <input type="hidden" id="id" name="Post[postid]" value="<?php echo $model->postid;?>">
            <table class="view-form-input" border="0" cellspacing="0" cellpadding="0" width="100%">
                <thead>
                    <tr>
                        <th valign="top" class="td-title"><label for="catid"><font class="required">*</font>版块：</label></th>
                        <td class="td-input">
                          <select name="Post[forumid]" data-value="<?php  echo $model->forumid;?>">
             <option value="">请选择版块</option>
             <?php foreach($forum as $v){?>
                 <option value="<?php echo $v['forumid'];?>" <?php if($model->forumid==$v['forumid'])echo "selected='true'";?>><?php echo $v['name'];?></option>
              <?php }?>  
                </select>
                        </td>
                    </tr>
                  
                    <tr>
                        <th valign="top" class="td-title"><label for="catid"><font class="required">*</font>缩略图：</label></th>
                         <td  class="td-input" valign="top">
                         <?php
                       echo common\widgets\image\Image::widget(['options' => [
'id'=> 'images',
'name'=> 'Post[images]',
								'attributes'=> array_merge($model->attributes, array('id'=>$model->postid)),
								'model'=> $model

]]);

                       echo common\widgets\datetime\Datetime::widget(['options' => [
'id'=> 'datetime',
'name'=> 'Post[datetime]',
								'attributes'=> array_merge($model->attributes, array('id'=>$model->postid)),
								'model'=> $model

]]);


                       echo common\widgets\ueditor\Ueditor::widget(['options' => [
'id'=> 'radio',
'name'=> 'Post[radio]',
								'attributes'=> array_merge($model->attributes, array('id'=>$model->postid)),
								'model'=> $model,
								'param' => ['options' => ['一=1','二=2'], 'width'=> '100%', 'height'=> '400px']

]]);


?>


                     </td>   
                    </tr>
                     <tr>
                        <th valign="top" class="td-title"><label for="catid"><font class="required">*</font>标题：</label></th>
                        <td class="td-umeditor td-input"><input type="text" class="input-text" id="title" name="Post[subject]" value="<?php echo $model->subject;?>" style="width:400px">
                        </td>
                    </tr>
                     <tr>
                        <th valign="top" class="td-title"><label for="catid"><font class="required">*</font>内容：</label></th>
                        <td class="td-umeditor td-input"><textarea class="" type="text" id="content" name="Post[content]" style="width:80%; height:500px;"><?php echo $model->content;?></textarea>
                        </td>
                    </tr>
                                        <tr>
                        <th valign="top" class="td-title"><label for="catid">原文链接：</label></th>
                        <td class="td-input"><input type="text" class="input-text" id="linkurl" name="Post[linkurl]" value="<?php echo $model->linkurl;?>" style="width:400px"> <font color="red">http://开头 (如微信公众号的文章链接)</font></td>
                    </tr>         
                                        <tr>
                      <tr>
                        <th></th>
                        <td><br>
                        <button class="ui-btn ui-btn-primary" type="submit">提交</button>
                            </td>
                    </tr>
                    
                        </tbody>
                    
            </table>
<input type="hidden" class="input-text" id="_csrf" name="_csrf" value="<?php echo Yii::$app->request->csrfToken;?>">
 <input type="hidden" class="input-text" id="time" name="Forum[datetime]" value="<?php echo time();?>">   
    
        
    </form>
<script type="text/javascript">
$(function(){

       
	//需要表单验证的请在这里配置，文档
	$("#view-form-form").validate({
		//debug:true, //如果只调试验证不提交数据，可开启这里
		rules: {
			'Post[forumid]':{
				required:true,
			},
			'Post[subject]':{
				required:true,
				maxlength:35
			},
		},
		messages: {
			'Post[forumid]':{
				required:'请选择版块'
			},
			'Post[subject]':{
				required:'请输入版块标题',
				maxlength:'标题长度不多于35个字符'
			},       
		},     
	});
});
</script>
<?php echo yii\base\View::render('/_include/_footer');?>
</body>
</html>


